/******************************************************************************
** 公司名称：天津柯迪斯科技有限公司
** 版权信息：
** 文件名称： bsp_LCD.h
** 模块名称： KD716_AT32F415CBT7-CAN表LCD初始化模块
** 版 本 号： V1.0
** 作    者： 蒲磊
** 
** 修改记录： 版本     修改人      时间         修改内容
**
******************************************************************************/
#ifndef __BSP_LCD_H_
#define __BSP_LCD_H_

/******************************************************************************
* 头文件
******************************************************************************/
#include "main.h"
#include "bsp.h"
/******************************************************************************
* 宏定义                           
******************************************************************************/
typedef enum
{
    eKDS_Nav_Left = 0,
    eKDS_Nav_Right,
    eKDS_Nav_Around,
    eKDS_Nav_Straight
} en_direction;


#define set_bit(val,bitn) val |=  (1 << bitn)
#define clr_bit(val,bitn) val &= ~(1 << bitn)

extern  uint8_t 	 gucLCD_Buffer[20];        /*LCD缓存，160*2 = 320  320/8 = 40*/
#define LCD_RAM  gucLCD_Buffer
typedef enum
{
	SEG_N1 = 0,
	SEG_N2 ,
	SEG_N3 ,
	SEG_N4 ,
	SEG_N5 ,
	SEG_N6 ,
	SEG_N7 ,
	SEG_N8 ,
	SEG_N9 ,
	SEG_N10,
	SEG_N11,
	SEG_N12,
	SEG_N13,
	SEG_N14,
	SEG_N15,
	SEG_N16,
	SEG_N17,
	SEG_N18, 
 
}enSEG_Nx_TYPE;




//****************************************
#define N1_A_ON   set_bit(LCD_RAM[2],5)
#define N1_A_OFF  clr_bit(LCD_RAM[2],5)

#define N1_B_ON   set_bit(LCD_RAM[2],6)
#define N1_B_OFF  clr_bit(LCD_RAM[2],6)

#define N1_C_ON   set_bit(LCD_RAM[2],7)
#define N1_C_OFF  clr_bit(LCD_RAM[2],7)

#define N1_D_ON   set_bit(LCD_RAM[1],0)
#define N1_D_OFF  clr_bit(LCD_RAM[1],0)

#define N1_E_ON   set_bit(LCD_RAM[1],1)
#define N1_E_OFF  clr_bit(LCD_RAM[1],1)

#define N1_F_ON   set_bit(LCD_RAM[1],3)
#define N1_F_OFF  clr_bit(LCD_RAM[1],3)

#define N1_G_ON   set_bit(LCD_RAM[1],2)
#define N1_G_OFF  clr_bit(LCD_RAM[1],2)

//****************************************
/*926屏和716的A-M顺序不同，为了用gusSegTab_13，以及显示函数，故在此模仿716的顺序填写*/

#define N2_A_ON   set_bit(LCD_RAM[4],7)   /*在屏资料上此为2H*/
#define N2_A_OFF  clr_bit(LCD_RAM[4],7)

#define N2_B_ON   set_bit(LCD_RAM[3],0)   /*在屏资料上此为2A*/
#define N2_B_OFF  clr_bit(LCD_RAM[3],0)

#define N2_C_ON   set_bit(LCD_RAM[3],1)   /*在屏资料上此为2I*/
#define N2_C_OFF  clr_bit(LCD_RAM[3],1)
                                  
#define N2_D_ON   set_bit(LCD_RAM[3],2)   /*在屏资料上此为2B*/
#define N2_D_OFF  clr_bit(LCD_RAM[3],2)

#define N2_E_ON   set_bit(LCD_RAM[5],6)  /*在屏资料上此为2J*/
#define N2_E_OFF  clr_bit(LCD_RAM[5],6)
                                  
#define N2_F_ON   set_bit(LCD_RAM[5],7)  /*在屏资料上此为2C*/
#define N2_F_OFF  clr_bit(LCD_RAM[5],7)
                                  
#define N2_G_ON   set_bit(LCD_RAM[4],0)  /*在屏资料上此为2K*/
#define N2_G_OFF  clr_bit(LCD_RAM[4],0)
                                  
#define N2_H_ON   set_bit(LCD_RAM[4],1)  /*在屏资料上此为2D*/
#define N2_H_OFF  clr_bit(LCD_RAM[4],1)

#define N2_I_ON   set_bit(LCD_RAM[4],2)  /*在屏资料上此为2L*/
#define N2_I_OFF  clr_bit(LCD_RAM[4],2)
                                  
#define N2_J_ON   set_bit(LCD_RAM[4],3)  /*在屏资料上此为2E*/
#define N2_J_OFF  clr_bit(LCD_RAM[4],3)
                                  
#define N2_K_ON   set_bit(LCD_RAM[4],5)  /*在屏资料上此为2M*/
#define N2_K_OFF  clr_bit(LCD_RAM[4],5)
                                  
#define N2_L_ON   set_bit(LCD_RAM[4],6)   /*在屏资料上此为2F*/
#define N2_L_OFF  clr_bit(LCD_RAM[4],6)

#define N2_M_ON   set_bit(LCD_RAM[4],4)   /*在屏资料上此为2G*/
#define N2_M_OFF  clr_bit(LCD_RAM[4],4)

//****************************************
#define N3_A_ON   set_bit(LCD_RAM[3],6)   
#define N3_A_OFF  clr_bit(LCD_RAM[3],6)

#define N3_B_ON   set_bit(LCD_RAM[3],7)
#define N3_B_OFF  clr_bit(LCD_RAM[3],7)

#define N3_C_ON   set_bit(LCD_RAM[2],0)
#define N3_C_OFF  clr_bit(LCD_RAM[2],0)

#define N3_D_ON   set_bit(LCD_RAM[2],1)
#define N3_D_OFF  clr_bit(LCD_RAM[2],1)

#define N3_E_ON   set_bit(LCD_RAM[5],0)
#define N3_E_OFF  clr_bit(LCD_RAM[5],0)
								  
#define N3_F_ON   set_bit(LCD_RAM[5],1)
#define N3_F_OFF  clr_bit(LCD_RAM[5],1)
								  
#define N3_G_ON   set_bit(LCD_RAM[5],2)
#define N3_G_OFF  clr_bit(LCD_RAM[5],2)
								  
#define N3_H_ON   set_bit(LCD_RAM[5],3)
#define N3_H_OFF  clr_bit(LCD_RAM[5],3)

#define N3_I_ON   set_bit(LCD_RAM[5],4)
#define N3_I_OFF  clr_bit(LCD_RAM[5],4)

#define N3_J_ON   set_bit(LCD_RAM[5],5)
#define N3_J_OFF  clr_bit(LCD_RAM[5],5)

#define N3_K_ON   set_bit(LCD_RAM[3],4)
#define N3_K_OFF  clr_bit(LCD_RAM[3],4)

#define N3_L_ON   set_bit(LCD_RAM[3],5)
#define N3_L_OFF  clr_bit(LCD_RAM[3],5)

#define N3_M_ON   set_bit(LCD_RAM[3],3)
#define N3_M_OFF  clr_bit(LCD_RAM[3],3)

//****************************************
#define N4_A_ON   set_bit(LCD_RAM[17],0)
#define N4_A_OFF  clr_bit(LCD_RAM[17],0)
								  
#define N4_B_ON   set_bit(LCD_RAM[17],1)
#define N4_B_OFF  clr_bit(LCD_RAM[17],1)
								  
#define N4_C_ON   set_bit(LCD_RAM[17],2)
#define N4_C_OFF  clr_bit(LCD_RAM[17],2)
								  
#define N4_D_ON   set_bit(LCD_RAM[17],3)
#define N4_D_OFF  clr_bit(LCD_RAM[17],3)
								  
#define N4_E_ON   set_bit(LCD_RAM[17],4)
#define N4_E_OFF  clr_bit(LCD_RAM[17],4)
								  
#define N4_F_ON   set_bit(LCD_RAM[13],3)
#define N4_F_OFF  clr_bit(LCD_RAM[13],3)
								  
#define N4_G_ON   set_bit(LCD_RAM[13],4)
#define N4_G_OFF  clr_bit(LCD_RAM[13],4)

#define N4_H_ON   set_bit(LCD_RAM[13],5)
#define N4_H_OFF  clr_bit(LCD_RAM[13],5)
		 
#define N4_I_ON   set_bit(LCD_RAM[6],6)
#define N4_I_OFF  clr_bit(LCD_RAM[6],6)
		 
#define N4_J_ON   set_bit(LCD_RAM[6],7)
#define N4_J_OFF  clr_bit(LCD_RAM[6],7)
		 
#define N4_K_ON   set_bit(LCD_RAM[18],6)
#define N4_K_OFF  clr_bit(LCD_RAM[18],6)
		 
#define N4_L_ON   set_bit(LCD_RAM[18],7)
#define N4_L_OFF  clr_bit(LCD_RAM[18],7)
		 
#define N4_M_ON   set_bit(LCD_RAM[18],5)
#define N4_M_OFF  clr_bit(LCD_RAM[18],5)
//****************************************

#define N5_A_ON   set_bit(LCD_RAM[7],4)
#define N5_A_OFF  clr_bit(LCD_RAM[7],4)
								  
#define N5_B_ON   set_bit(LCD_RAM[7],5)
#define N5_B_OFF  clr_bit(LCD_RAM[7],5)
								  
#define N5_C_ON   set_bit(LCD_RAM[7],7)
#define N5_C_OFF  clr_bit(LCD_RAM[7],7)
								  
#define N5_D_ON   set_bit(LCD_RAM[6],0)
#define N5_D_OFF  clr_bit(LCD_RAM[6],0)
								  
#define N5_E_ON   set_bit(LCD_RAM[6],1)
#define N5_E_OFF  clr_bit(LCD_RAM[6],1)
								  
#define N5_F_ON   set_bit(LCD_RAM[6],2)
#define N5_F_OFF  clr_bit(LCD_RAM[6],2)
								 
#define N5_G_ON   set_bit(LCD_RAM[7],6)
#define N5_G_OFF  clr_bit(LCD_RAM[7],6)
//****************************************

#define N6_A_ON   set_bit(LCD_RAM[8],4)
#define N6_A_OFF  clr_bit(LCD_RAM[8],4)
								      
#define N6_B_ON   set_bit(LCD_RAM[8],5)
#define N6_B_OFF  clr_bit(LCD_RAM[8],5)
								      
#define N6_C_ON   set_bit(LCD_RAM[8],7)
#define N6_C_OFF  clr_bit(LCD_RAM[8],7)
								      
#define N6_D_ON   set_bit(LCD_RAM[7],0)
#define N6_D_OFF  clr_bit(LCD_RAM[7],0)
								      
#define N6_E_ON   set_bit(LCD_RAM[7],1)
#define N6_E_OFF  clr_bit(LCD_RAM[7],1)
								      
#define N6_F_ON   set_bit(LCD_RAM[7],2)
#define N6_F_OFF  clr_bit(LCD_RAM[7],2)
								      
#define N6_G_ON   set_bit(LCD_RAM[8],6)
#define N6_G_OFF  clr_bit(LCD_RAM[8],6)

//****************************************

#define N7_A_ON   set_bit(LCD_RAM[9],4)
#define N7_A_OFF  clr_bit(LCD_RAM[9],4)
                                    
#define N7_B_ON   set_bit(LCD_RAM[9],5)
#define N7_B_OFF  clr_bit(LCD_RAM[9],5)
                                    
#define N7_C_ON   set_bit(LCD_RAM[9],7)
#define N7_C_OFF  clr_bit(LCD_RAM[9],7)
                                    
#define N7_D_ON   set_bit(LCD_RAM[8],0)
#define N7_D_OFF  clr_bit(LCD_RAM[8],0)
                                    
#define N7_E_ON   set_bit(LCD_RAM[8],1)
#define N7_E_OFF  clr_bit(LCD_RAM[8],1)
                                    
#define N7_F_ON   set_bit(LCD_RAM[8],2)
#define N7_F_OFF  clr_bit(LCD_RAM[8],2)
                                    
#define N7_G_ON   set_bit(LCD_RAM[9],6)
#define N7_G_OFF  clr_bit(LCD_RAM[9],6)

//*************************************

#define N8_A_ON   set_bit(LCD_RAM[10],4)
#define N8_A_OFF  clr_bit(LCD_RAM[10],4)
                                    
#define N8_B_ON   set_bit(LCD_RAM[10],5)
#define N8_B_OFF  clr_bit(LCD_RAM[10],5)
                                    
#define N8_C_ON   set_bit(LCD_RAM[10],7)
#define N8_C_OFF  clr_bit(LCD_RAM[10],7)
                                    
#define N8_D_ON   set_bit(LCD_RAM[9],0)
#define N8_D_OFF  clr_bit(LCD_RAM[9],0)
                                    
#define N8_E_ON   set_bit(LCD_RAM[9],1)
#define N8_E_OFF  clr_bit(LCD_RAM[9],1)
                                   
#define N8_F_ON   set_bit(LCD_RAM[9],2)
#define N8_F_OFF  clr_bit(LCD_RAM[9],2)
                                    
#define N8_G_ON   set_bit(LCD_RAM[10],6)
#define N8_G_OFF  clr_bit(LCD_RAM[10],6)

//*************************************

#define N9_A_ON   set_bit(LCD_RAM[11],4)
#define N9_A_OFF  clr_bit(LCD_RAM[11],4)
                                      
#define N9_B_ON   set_bit(LCD_RAM[11],5)
#define N9_B_OFF  clr_bit(LCD_RAM[11],5)
                                     
#define N9_C_ON   set_bit(LCD_RAM[11],7)
#define N9_C_OFF  clr_bit(LCD_RAM[11],7)
                                     
#define N9_D_ON   set_bit(LCD_RAM[10],0)
#define N9_D_OFF  clr_bit(LCD_RAM[10],0)
                                     
#define N9_E_ON   set_bit(LCD_RAM[10],1)
#define N9_E_OFF  clr_bit(LCD_RAM[10],1)
                                     
#define N9_F_ON   set_bit(LCD_RAM[10],2)
#define N9_F_OFF  clr_bit(LCD_RAM[10],2)
                                     
#define N9_G_ON   set_bit(LCD_RAM[11],6)
#define N9_G_OFF  clr_bit(LCD_RAM[11],6)

//*************************************
#define N10_A_ON   set_bit(LCD_RAM[12],3)
#define N10_A_OFF  clr_bit(LCD_RAM[12],3)
								   
#define N10_B_ON   set_bit(LCD_RAM[12],4)
#define N10_B_OFF  clr_bit(LCD_RAM[12],4)
								   
#define N10_C_ON   set_bit(LCD_RAM[12],6)
#define N10_C_OFF  clr_bit(LCD_RAM[12],6)
								   
#define N10_D_ON   set_bit(LCD_RAM[12],7)
#define N10_D_OFF  clr_bit(LCD_RAM[12],7)
								   
#define N10_E_ON   set_bit(LCD_RAM[11],0)
#define N10_E_OFF  clr_bit(LCD_RAM[11],0)
								   
#define N10_F_ON   set_bit(LCD_RAM[11],1)
#define N10_F_OFF  clr_bit(LCD_RAM[11],1)
								   
#define N10_G_ON   set_bit(LCD_RAM[12],5)
#define N10_G_OFF  clr_bit(LCD_RAM[12],5)

//*************************************
#define N11_A_ON  // set_bit(LCD_RAM[3],5)
#define N11_A_OFF // clr_bit(LCD_RAM[3],5)
					//			      
#define N11_B_ON  // set_bit(LCD_RAM[3],7)
#define N11_B_OFF // clr_bit(LCD_RAM[3],7)
					//			      
#define N11_C_ON  // set_bit(LCD_RAM[3],6)
#define N11_C_OFF // clr_bit(LCD_RAM[3],6)
					//			      
#define N11_D_ON  // set_bit(LCD_RAM[2],0)
#define N11_D_OFF // clr_bit(LCD_RAM[2],0)
					//			      
#define N11_E_ON  // set_bit(LCD_RAM[2],2)
#define N11_E_OFF // clr_bit(LCD_RAM[2],2)
					//			      
#define N11_F_ON  // set_bit(LCD_RAM[2],3)
#define N11_F_OFF // clr_bit(LCD_RAM[2],3)
					//			      
#define N11_G_ON  // set_bit(LCD_RAM[2],1)
#define N11_G_OFF // clr_bit(LCD_RAM[2],1)
				  //
//****************//*********************
#define N13_A_ON  // set_bit(LCD_RAM[7],5)
#define N13_A_OFF // clr_bit(LCD_RAM[7],5)
					//			   
#define N13_B_ON  // set_bit(LCD_RAM[5],7)
#define N13_B_OFF // clr_bit(LCD_RAM[5],7)
					//			   
#define N13_C_ON  // set_bit(LCD_RAM[5],6)
#define N13_C_OFF // clr_bit(LCD_RAM[5],6)
					//			   
#define N13_D_ON  // set_bit(LCD_RAM[4],0)
#define N13_D_OFF // clr_bit(LCD_RAM[4],0)
					//			   
#define N13_E_ON  // set_bit(LCD_RAM[4],2)
#define N13_E_OFF // clr_bit(LCD_RAM[4],2)
					//			   
#define N13_F_ON  // set_bit(LCD_RAM[4],3)
#define N13_F_OFF // clr_bit(LCD_RAM[4],3)
					//			   
#define N13_G_ON  // set_bit(LCD_RAM[4],1)
#define N13_G_OFF // clr_bit(LCD_RAM[4],1)
				  //
//****************//*********************
#define N14_A_ON  // set_bit(LCD_RAM[6],7)
#define N14_A_OFF // clr_bit(LCD_RAM[6],7)
					//			      
#define N14_B_ON  // set_bit(LCD_RAM[5],1)
#define N14_B_OFF // clr_bit(LCD_RAM[5],1)
					//			      
#define N14_C_ON  // set_bit(LCD_RAM[5],0)
#define N14_C_OFF // clr_bit(LCD_RAM[5],0)
					//			      
#define N14_D_ON  // set_bit(LCD_RAM[5],2)
#define N14_D_OFF // clr_bit(LCD_RAM[5],2)
					//			      
#define N14_E_ON  // set_bit(LCD_RAM[5],4)
#define N14_E_OFF // clr_bit(LCD_RAM[5],4)
					//			      
#define N14_F_ON  // set_bit(LCD_RAM[5],5)
#define N14_F_OFF // clr_bit(LCD_RAM[5],5)
					//			      
#define N14_G_ON  // set_bit(LCD_RAM[5],3)
#define N14_G_OFF // clr_bit(LCD_RAM[5],3)
				  //
//****************//*********************
#define N15_A_ON  // set_bit(LCD_RAM[7],7)
#define N15_A_OFF // clr_bit(LCD_RAM[7],7)
					//			    
#define N15_B_ON  // set_bit(LCD_RAM[6],1)
#define N15_B_OFF // clr_bit(LCD_RAM[6],1)
					//			    
#define N15_C_ON  // set_bit(LCD_RAM[6],0)
#define N15_C_OFF // clr_bit(LCD_RAM[6],0)
					//			    
#define N15_D_ON  // set_bit(LCD_RAM[6],2)
#define N15_D_OFF // clr_bit(LCD_RAM[6],2)
					//			    
#define N15_E_ON  // set_bit(LCD_RAM[6],4)
#define N15_E_OFF // clr_bit(LCD_RAM[6],4)
					//			     
#define N15_F_ON  // set_bit(LCD_RAM[6],5)
#define N15_F_OFF // clr_bit(LCD_RAM[6],5)
					//			     
#define N15_G_ON  // set_bit(LCD_RAM[6],3)
#define N15_G_OFF // clr_bit(LCD_RAM[6],3)

//*************************************

								  
#define Z13_ON     set_bit(LCD_RAM[0],1)
#define Z13_OFF    clr_bit(LCD_RAM[0],1)

#define Z14_ON     set_bit(LCD_RAM[0],2)
#define Z14_OFF    clr_bit(LCD_RAM[0],2)

#define Z15_ON     set_bit(LCD_RAM[0],3)
#define Z15_OFF    clr_bit(LCD_RAM[0],3)

#define Z16_ON     set_bit(LCD_RAM[0],4)
#define Z16_OFF    clr_bit(LCD_RAM[0],4)

#define Z17_ON     set_bit(LCD_RAM[18],2)
#define Z17_OFF    clr_bit(LCD_RAM[18],2)

#define Z18_ON     set_bit(LCD_RAM[18],3)
#define Z18_OFF    clr_bit(LCD_RAM[18],3)

#define Z19_ON     set_bit(LCD_RAM[18],4)
#define Z19_OFF    clr_bit(LCD_RAM[18],4)

#define Z29_ON     set_bit(LCD_RAM[11],3)
#define Z29_OFF    clr_bit(LCD_RAM[11],3)

#define Z21_ON     set_bit(LCD_RAM[13],1)
#define Z21_OFF    clr_bit(LCD_RAM[13],1)

#define Z20_ON     set_bit(LCD_RAM[13],2)
#define Z20_OFF    clr_bit(LCD_RAM[13],2)

#define Z35_ON     set_bit(LCD_RAM[2],3)
#define Z35_OFF    clr_bit(LCD_RAM[2],3)

#define Z36_ON     set_bit(LCD_RAM[2],2)
#define Z36_OFF    clr_bit(LCD_RAM[2],2)

#define Z25_ON     set_bit(LCD_RAM[7],3)
#define Z25_OFF    clr_bit(LCD_RAM[7],3)

#define Z26_ON     set_bit(LCD_RAM[8],3)
#define Z26_OFF    clr_bit(LCD_RAM[8],3)

#define Z27_ON     set_bit(LCD_RAM[9],3)
#define Z27_OFF    clr_bit(LCD_RAM[9],3)

#define Z28_ON     set_bit(LCD_RAM[10],3)
#define Z28_OFF    clr_bit(LCD_RAM[10],3)

#define Z30_ON     set_bit(LCD_RAM[12],2)
#define Z30_OFF    clr_bit(LCD_RAM[12],2)

#define Z31_ON     set_bit(LCD_RAM[12],1)
#define Z31_OFF    clr_bit(LCD_RAM[12],1)

#define Z32_ON     set_bit(LCD_RAM[12],0)
#define Z32_OFF    clr_bit(LCD_RAM[12],0)

#define Z33_ON     set_bit(LCD_RAM[13],7)
#define Z33_OFF    clr_bit(LCD_RAM[13],7)

#define Z34_ON     set_bit(LCD_RAM[13],6)
#define Z34_OFF    clr_bit(LCD_RAM[13],6)

#define DOT_ON     set_bit(LCD_RAM[11],2)
#define DOT_OFF    clr_bit(LCD_RAM[11],2)

#define Z23_ON     set_bit(LCD_RAM[6],5)
#define Z23_OFF    clr_bit(LCD_RAM[6],5)
								   
#define Z22_ON     set_bit(LCD_RAM[6],4)
#define Z22_OFF    clr_bit(LCD_RAM[6],4)
								   
#define Z24_ON     set_bit(LCD_RAM[6],3)
#define Z24_OFF    clr_bit(LCD_RAM[6],3)

#define Z12_ON     set_bit(LCD_RAM[0],5)
#define Z12_OFF    clr_bit(LCD_RAM[0],5)

#define Z11_ON     set_bit(LCD_RAM[0],6)
#define Z11_OFF    clr_bit(LCD_RAM[0],6)

/*电量分段*/
#define Z1_ON     set_bit(LCD_RAM[0],7)
#define Z1_OFF    clr_bit(LCD_RAM[0],7)

#define Z2_ON     set_bit(LCD_RAM[18],1)
#define Z2_OFF    clr_bit(LCD_RAM[18],1)
								   
#define Z3_ON     set_bit(LCD_RAM[18],0)
#define Z3_OFF    clr_bit(LCD_RAM[18],0)

#define Z4_ON     set_bit(LCD_RAM[19],7)
#define Z4_OFF    clr_bit(LCD_RAM[19],7)
								   
#define Z5_ON     set_bit(LCD_RAM[19],6)
#define Z5_OFF    clr_bit(LCD_RAM[19],6)

#define Z6_ON     set_bit(LCD_RAM[19],5)
#define Z6_OFF    clr_bit(LCD_RAM[19],5)
								   
#define Z7_ON     set_bit(LCD_RAM[19],4)
#define Z7_OFF    clr_bit(LCD_RAM[19],4)

#define Z8_ON     set_bit(LCD_RAM[19],3)
#define Z8_OFF    clr_bit(LCD_RAM[19],3)
								   
#define Z9_ON     set_bit(LCD_RAM[19],2)
#define Z9_OFF    clr_bit(LCD_RAM[19],2)

#define Z10_ON    set_bit(LCD_RAM[19],1)
#define Z10_OFF   clr_bit(LCD_RAM[19],1)

/*档位环*/
#define X1_ON     set_bit(LCD_RAM[1],6)
#define X1_OFF    clr_bit(LCD_RAM[1],6)
		
#define X2_ON     set_bit(LCD_RAM[1],7)
#define X2_OFF    clr_bit(LCD_RAM[1],7)
								   
#define X3_ON     set_bit(LCD_RAM[1],5)
#define X3_OFF    clr_bit(LCD_RAM[1],5)
		
#define X4_ON     set_bit(LCD_RAM[1],4)
#define X4_OFF    clr_bit(LCD_RAM[1],4)
								   
#define X5_ON     set_bit(LCD_RAM[2],4)
#define X5_OFF    clr_bit(LCD_RAM[2],4)
		
#define X6_ON     set_bit(LCD_RAM[0],0)
#define X6_OFF    clr_bit(LCD_RAM[0],0)

/*速度环*/
#define X7_ON     set_bit(LCD_RAM[14],7)
#define X7_OFF    clr_bit(LCD_RAM[14],7)
								   
#define X8_ON     set_bit(LCD_RAM[14],6)
#define X8_OFF    clr_bit(LCD_RAM[14],6)
								   
#define X9_ON     set_bit(LCD_RAM[14],5)
#define X9_OFF    clr_bit(LCD_RAM[14],5)
								   
#define X10_ON    set_bit(LCD_RAM[14],4)
#define X10_OFF   clr_bit(LCD_RAM[14],4)
								   
#define X11_ON    set_bit(LCD_RAM[14],3)
#define X11_OFF   clr_bit(LCD_RAM[14],3)
								   
#define X12_ON    set_bit(LCD_RAM[14],2)
#define X12_OFF   clr_bit(LCD_RAM[14],2)
								   
#define X13_ON    set_bit(LCD_RAM[14],1)
#define X13_OFF   clr_bit(LCD_RAM[14],1)
								   
#define X14_ON    set_bit(LCD_RAM[14],0)
#define X14_OFF   clr_bit(LCD_RAM[14],0)

#define X15_ON     set_bit(LCD_RAM[15],7)
#define X15_OFF    clr_bit(LCD_RAM[15],7)
									
#define X16_ON     set_bit(LCD_RAM[15],6)
#define X16_OFF    clr_bit(LCD_RAM[15],6)								   

#define X17_ON     set_bit(LCD_RAM[15],3)
#define X17_OFF    clr_bit(LCD_RAM[15],3)
									
#define X18_ON     set_bit(LCD_RAM[15],2)
#define X18_OFF    clr_bit(LCD_RAM[15],2)
				 				   
#define X19_ON     set_bit(LCD_RAM[17],5)
#define X19_OFF    clr_bit(LCD_RAM[17],5)
									
#define X20_ON     set_bit(LCD_RAM[17],6)
#define X20_OFF    clr_bit(LCD_RAM[17],6)
									
#define X21_ON     set_bit(LCD_RAM[17],7)
#define X21_OFF    clr_bit(LCD_RAM[17],7)

#define X22_ON     set_bit(LCD_RAM[16],0)
#define X22_OFF    clr_bit(LCD_RAM[16],0)
									
#define X23_ON     set_bit(LCD_RAM[16],1)
#define X23_OFF    clr_bit(LCD_RAM[16],1)
									
#define X24_ON     set_bit(LCD_RAM[16],2)
#define X24_OFF    clr_bit(LCD_RAM[16],2)
									
#define X25_ON     set_bit(LCD_RAM[16],3)
#define X25_OFF    clr_bit(LCD_RAM[16],3)
									
#define X26_ON     set_bit(LCD_RAM[16],4)
#define X26_OFF    clr_bit(LCD_RAM[16],4)
									
#define X27_ON     set_bit(LCD_RAM[16],5)
#define X27_OFF    clr_bit(LCD_RAM[16],5)
									
#define X28_ON     set_bit(LCD_RAM[16],6)
#define X28_OFF    clr_bit(LCD_RAM[16],6)
									
#define X29_ON     set_bit(LCD_RAM[16],7)
#define X29_OFF    clr_bit(LCD_RAM[16],7)

#define X30_ON     set_bit(LCD_RAM[15],0)
#define X30_OFF    clr_bit(LCD_RAM[15],0)
									
#define X31_ON     set_bit(LCD_RAM[15],1)
#define X31_OFF    clr_bit(LCD_RAM[15],1)

#define X32_ON     set_bit(LCD_RAM[13],0)
#define X32_OFF    clr_bit(LCD_RAM[13],0)

#define X33_ON     set_bit(LCD_RAM[15],5)
#define X33_OFF    clr_bit(LCD_RAM[15],5)

#define X34_ON     set_bit(LCD_RAM[15],4)
#define X34_OFF    clr_bit(LCD_RAM[15],4)

 /**************新架构****************/

#define ICO_LIGHT_LEFT_ON       Z13_ON
#define ICO_LIGHT_LEFT_OFF      Z13_OFF

#define ICO_LIGHT_RIGHT_ON      Z19_ON
#define ICO_LIGHT_RIGHT_OFF     Z19_OFF			      
 
#define ICO_LAMP_ON             Z14_ON   /*大灯 */ 
#define ICO_LAMP_OFF            Z14_OFF 
    
#define ICO_USB_ON              Z15_ON   /*USB */ 
#define ICO_USB_OFF             Z15_OFF  

#define ICO_PUSH_ON             Z16_ON   /* 推行符号 */
#define ICO_PUSH_OFF            Z16_OFF 

#define ICO_BLE_ON              Z17_ON   /*蓝牙 */ 
#define ICO_BLE_OFF             Z17_OFF 

#define ICO_CRUISE_ON           Z18_ON   /*巡航*/
#define ICO_CRUISE_OFF          Z18_OFF     

#define ICO_LOCATION_ON         X34_ON   /*findMy*/
#define ICO_LOCATION_OFF        X34_OFF     

#define ICO_WRENCH_ON           Z29_ON   /*ERROR扳手*/
#define ICO_WRENCH_OFF          Z29_OFF 

#define ICO_KMH_ON              Z21_ON   /**/
#define ICO_KMH_OFF             Z21_OFF 
							 
#define ICO_MPH_ON              Z20_ON   /**/
#define ICO_MPH_OFF             Z20_OFF 

#define ICO_MAX_ON              Z35_ON   /*MAX */
#define ICO_MAX_OFF             Z35_OFF 
                                  
#define ICO_AVG_ON              Z36_ON   /*AVG */
#define ICO_AVG_OFF             Z36_OFF 
							    
#define ICO_TRIP_ON             Z25_ON  /* TRIP */
#define ICO_TRIP_OFF            Z25_OFF

#define ICO_ODO_ON              Z26_ON   /*ODO*/
#define ICO_ODO_OFF             Z26_OFF 
							    
#define ICO_TIME_ON             Z27_ON   /* TIME */
#define ICO_TIME_OFF            Z27_OFF 
							      
#define ICO_POWER_ON            Z28_ON /* POWER */
#define ICO_POWER_OFF           Z28_OFF 

#define ICO_W_ON                Z31_ON  /* W */
#define ICO_W_OFF               Z31_OFF 
							    
#define ICO_MIN_ON              Z32_ON  /* MIN */
#define ICO_MIN_OFF             Z32_OFF 
							    
#define ICO_MILE_ON             Z33_ON   /* MILE */
#define ICO_MILE_OFF            Z33_OFF 
							    
#define ICO_KM_ON               Z34_ON   /* KM */
#define ICO_KM_OFF              Z34_OFF 

#define ICO_LINE_BOT_ON         Z30_ON   /* 下横线 */
#define ICO_LINE_BOT_OFF        Z30_OFF 

#define ICO_LINE_ABOVE_ON       Z12_ON   /* 上横线 */
#define ICO_LINE_AVOVE_OFF      Z12_OFF 

#define ICO_POINT_ON            DOT_ON /* 小数点 */
#define ICO_POINT_OFF           DOT_OFF  

#define ICO_DRIVE2_HUMAN_ON     Z22_ON  /* 双驱人像 */
#define ICO_DRIVE2_HUMAN_OFF    Z22_OFF 
							    
#define ICO_DRIVE2_BACK_ON      Z23_ON  /* 后驱 */
#define ICO_DRIVE2_BACK_OFF     Z23_OFF 
							    
#define ICO_DRIVE2_FRONT_ON     Z24_ON  /* 前驱 */
#define ICO_DRIVE2_FRONT_OFF    Z24_OFF 

#define ICO_BAT_FRAME_ON        Z11_ON   /*BATTERY*/
#define ICO_BAT_FRAME_OFF       Z11_OFF 

#define ICO_BAT_LEV1_ON         Z1_ON;Z2_ON;    /*电量格 1 */
#define ICO_BAT_LEV1_OFF        Z1_OFF;Z2_OFF; 
                                
#define ICO_BAT_LEV2_ON         Z3_ON;Z4_ON;    /*电量格 2 */
#define ICO_BAT_LEV2_OFF        Z3_OFF;Z4_OFF; 
                                
#define ICO_BAT_LEV3_ON         Z5_ON;Z6_ON;    /*电量格 3 */
#define ICO_BAT_LEV3_OFF        Z5_OFF;Z6_OFF; 
                                
#define ICO_BAT_LEV4_ON         Z7_ON;Z8_ON;    /*电量格 4 */
#define ICO_BAT_LEV4_OFF        Z7_OFF;Z8_OFF; 
                                
#define ICO_BAT_LEV5_ON         Z9_ON;Z10_ON;   /*电量格 5 */ 
#define ICO_BAT_LEV5_OFF        Z9_OFF;Z10_OFF;  

#define ICO_GEAR1_FRAME_ON      X1_ON  /* 1档 档位框  */
#define ICO_GEAR1_FRAME_OFF     X1_OFF 
							    
#define ICO_GEAR2_FRAME_ON      X2_ON  /* 2档 档位框  */
#define ICO_GEAR2_FRAME_OFF     X2_OFF 
							    		
#define ICO_GEAR3_FRAME_ON      X3_ON  /* 3档 档位框  */
#define ICO_GEAR3_FRAME_OFF     X3_OFF 
							    
#define ICO_GEAR4_FRAME_ON      X4_ON  /* 4档 档位框  */
#define ICO_GEAR4_FRAME_OFF     X4_OFF 
							    		
#define ICO_GEAR5_FRAME_ON      X5_ON  /* 5档 档位框  */
#define ICO_GEAR5_FRAME_OFF     X5_OFF 

#define ICO_GEAR_CIRCLE_ON      X6_ON  /* 档位的小圆环*/
#define ICO_GEAR_CIRCLE_OFF     X6_OFF 

#define ICO_CIRCLE_INSIDE_ON    X32_ON  /* 速度内侧的圆环*/
#define ICO_CIRCLE_INSIDE_OFF   X32_OFF 

#define ICO_CIRCLE_OUTSIDE_ON   X33_ON  /* 速度外侧的圆环*/
#define ICO_CIRCLE_OUTSIDE_OFF  X33_OFF 


//=========


#define N12_A_ON   ;
#define N12_A_OFF  ;
#define N12_B_ON   ; 
#define N12_B_OFF  ;
#define N12_C_ON   ; 
#define N12_C_OFF  ;                  
#define N12_D_ON   ; 
#define N12_D_OFF  ;
#define N12_E_ON   ; 
#define N12_E_OFF  ;              
#define N12_F_ON   ; 
#define N12_F_OFF  ;                  
#define N12_G_ON   ; 
#define N12_G_OFF  ;



//#define LCD_CLK_0	GPIOA->BRR  = (uint32_t)GPIO_PIN_5;
//#define LCD_CLK_1	GPIOA->BSRR = (uint32_t)GPIO_PIN_5;
//#define LCD_DI_0	GPIOA->BRR  = (uint32_t)GPIO_PIN_6;
//#define LCD_DI_1	GPIOA->BSRR = (uint32_t)GPIO_PIN_6;
//#define LCD_RST_0	GPIOA->BRR  = (uint32_t)GPIO_PIN_4;
//#define LCD_RST_1	GPIOA->BSRR = (uint32_t)GPIO_PIN_4;
//#define LCD_CS_0    GPIOA->BRR  = (uint32_t)GPIO_PIN_7;
//#define LCD_CS_1    GPIOA->BSRR = (uint32_t)GPIO_PIN_7;

#define LCD_VLCD_1    GPIOA->BRR  = (uint32_t)GPIO_PIN_8; //926和716的相反
#define LCD_VLCD_0    GPIOA->BSRR = (uint32_t)GPIO_PIN_8;


#define RST_Pin 	   GPIO_PIN_4
#define RST_GPIO_Port  GPIOA
#define SCLK_Pin 	   GPIO_PIN_5
#define SCLK_GPIO_Port GPIOA
#define SDI_Pin 	   GPIO_PIN_6
#define SDI_GPIO_Port  GPIOA
#define SS_Pin 		   GPIO_PIN_7
#define SS_GPIO_Port   GPIOA

#define LCD_CS_1               HAL_GPIO_WritePin(SS_GPIO_Port, SS_Pin, GPIO_PIN_SET);   
#define LCD_CS_0              HAL_GPIO_WritePin(SS_GPIO_Port, SS_Pin, GPIO_PIN_RESET);

#define LCD_CLK_1              HAL_GPIO_WritePin(SCLK_GPIO_Port, SCLK_Pin, GPIO_PIN_SET); //__NOP;__NOP;__NOP;       /*加NOP是为了降低写屏频率*/
#define LCD_CLK_0             HAL_GPIO_WritePin(SCLK_GPIO_Port, SCLK_Pin, GPIO_PIN_RESET);//__NOP;__NOP;__NOP;

#define LCD_DI_1              HAL_GPIO_WritePin(SDI_GPIO_Port,SDI_Pin,GPIO_PIN_SET);
#define LCD_DI_0              HAL_GPIO_WritePin(SDI_GPIO_Port,SDI_Pin,GPIO_PIN_RESET);

#define VLCD_OFF             HAL_GPIO_WritePin(VLCD_GPIO_Port,VLCD_Pin,GPIO_PIN_SET);
#define VLCD_ON              HAL_GPIO_WritePin(VLCD_GPIO_Port,VLCD_Pin,GPIO_PIN_RESET);

#define LCD_RST_1              HAL_GPIO_WritePin(RST_GPIO_Port,RST_Pin,GPIO_PIN_SET);
#define LCD_RST_0             HAL_GPIO_WritePin(RST_GPIO_Port,RST_Pin,GPIO_PIN_RESET);

/******************************************************************************
* 类型定义                                      
******************************************************************************/
#define ON      1
#define OFF     0
/******************************************************************************
* 全局变量声明 
******************************************************************************/
 
/******************************************************************************
* 函数声明 
******************************************************************************/
void vBsp_LCD_Init(void);
void vBsp_LCD_Reset(void);
void vBsp_LCD_OFF(void);
void vBsp_LCD_Refresh(void);
void vBsp_LCD_Clear(void);
void vBsp_LCD_DispAll(void);
void vBsp_LCD_DispICO_Lamp(uint8_t OnOff);
void vBsp_LCD_DispICO_USB(uint8_t OnOff);
void vBsp_LCD_DispICO_Break(uint8_t OnOff);
void vBsp_LCD_DispICO_Service(uint8_t OnOff);
void vBsp_LCD_DispICO_Bluetooth(uint8_t OnOff);
void vBsp_LCD_DispICO_KPH(uint8_t OnOff);
void vBsp_LCD_DispICO_MPH(uint8_t OnOff);
void vBsp_LCD_DispICO_Max(uint8_t OnOff);
void vBsp_LCD_DispICO_Avg(uint8_t OnOff);
void vBsp_LCD_DispICO_Eco(uint8_t OnOff);
void vBsp_LCD_DispICO_Normal(uint8_t OnOff);
void vBsp_LCD_DispICO_Sport(uint8_t OnOff);
void vBsp_LCD_DispICO_Trip(uint8_t OnOff);
void vBsp_LCD_DispICO_ODO(uint8_t OnOff);
void vBsp_LCD_DispICO_Time(uint8_t OnOff);
void vBsp_LCD_DispICO_Power(uint8_t OnOff);
void vBsp_LCD_DispICO_Menu(uint8_t OnOff);
void vBsp_LCD_DispICO_Unit_W(uint8_t OnOff);
void vBsp_LCD_DispICO_Unit_Min(uint8_t OnOff);
void vBsp_LCD_DispICO_Unit_Mile(uint8_t OnOff);
void vBsp_LCD_DispICO_Unit_Km(uint8_t OnOff);
void vBsp_LCD_DispICO_Line(uint8_t OnOff);
void vBsp_LCD_DispSpeedNum(uint16_t Speed,uint8_t OnOff);
void vBsp_LCD_DispPas(int8_t Pas,uint8_t OnOff);
//void vBsp_LCD_DispMode(uint8_t Mode);
void vBsp_LCD_DispPasLine(int8_t Pas,uint8_t OnOff);
void vBsp_LCD_DispStringAtSpeed(char *pString,uint8_t OnOff);
void vBsp_LCD_DispBatteryBar(uint8_t BatLevel,uint8_t OnOff);
void vBsp_LCD_DispSocNum(uint8_t Soc,uint8_t OnOff);
void vLCD_DispSoc(uint8_t Value,uint8_t Level5,uint8_t Level4,uint8_t Level3,uint8_t Level2,uint8_t Level1);
void vBsp_LCD_DispNumber(uint32_t Data,uint8_t Scale,uint8_t OnOff);
void vBsp_LCD_DispStringAtBottom(char *pString,uint8_t lucIndex,uint8_t OnOff);
void vBsp_LCD_DispOdo(uint32_t Odo,uint8_t Unit,uint8_t OnOff);
void vBsp_LCD_DispTrip(uint32_t Trip,uint8_t Unit,uint8_t OnOff);
void vBsp_LCD_DispSpeed(uint16_t Speed,uint8_t Unit,uint8_t OnOff);
void vBsp_LCD_DispMaxSpeed(uint16_t MaxSpeed,uint8_t Unit,uint8_t OnOff);
void vBsp_LCD_DispAvgSpeed(uint16_t AvgSpeed,uint8_t Unit,uint8_t OnOff);
void vBsp_LCD_DispTime(uint32_t Time,uint8_t OnOff);
void vBsp_LCD_DispPower(uint16_t Power,uint8_t OnOff);
void vBsp_LCD_DispErrorCode(uint8_t Error);
void vBsp_LCD_DispSetClearTrip(uint8_t State);
void vBsp_LCD_DispSetBacklight(uint8_t Backlight);
void vBsp_LCD_DispSetUnit(uint8_t Unit);
void vBsp_LCD_DispSetWheel(uint16_t Wheel,uint8_t Type);
void vBsp_LCD_DispSetLimitSpeed(uint16_t LimitSpeed,uint8_t Scale,uint8_t Type);
void vBsp_LCD_DispPasswordNum(uint16_t Password,uint8_t FlashBit);


//void vBsp_LCD_DispSetWheel(uint16_t Wheel);
//void vBsp_LCD_DispSetLimitSpeed(uint16_t LimitSpeed,uint8_t Unit);

void vBsp_LCD_DispSetDriveMode(uint8_t ucDriveMode); 
void vBsp_LCD_DispSetAccelerateMode(uint8_t ucAccelerateMode);
void vBsp_LCD_DispCharging(uint8_t Value);

void vBsp_LCD_DispNavigation_Nums(uint32_t ulDistance, uint8_t dot, uint8_t decimal);
void vBsp_LCD_Disp_Navigation(uint8_t direction, uint32_t distance);
void vBsp_LCD_Hide_Navigation(void);

void vBsp_LCD_DispSpeedCircle(uint8_t ucValue,uint8_t OnOff);
#endif
